#include <iostream>
#include "vectorfunctions.h"

void permutariD(int x[], int l)
{
	int i, j, aux, temp;
	int s[100];
	for(i=0; i<l; i++){
		j=i+1;
		aux=x[i];
		while (j!=i){
			if(j==l){
				j=0;
				temp=x[j];
				x[j]=aux;
				aux=temp;
				if(i!=0)
					++j;
				}			
			
			else {
				temp=x[j];
				x[j]=aux;
				aux=temp;
				++j;
			}	
		}
		if(j!=0)
			x[j]=aux;
		printVector(x, l);	
	}
}

int main()
{
	int l;
	int x[100];
	cout<<"Length of array :";
	cin>>l;
	readVector(x, l);
	printVector(x, l);
	permutariD(x, l);
return 0;
}
